/********************************************************************************************
        Benny - The game
        
        Author: Martin Albrecht <martin.albrecht@javacoffee.de>
        Date: Something like 2004/2005... maybe? ;)
        Website: http://code.javacofee.de
                
DEPENDENCIES:
-------------
        - SDL library with SDL_TTF, SDL_MIXER, SDL_TIMER and SDL_IMAGE 
		  see http://www.libsdl.org/ for more information.

LICENSE:
--------
        This program is free software; you can redistribute it and/or modify it under
        the terms of the GNU General Public License as published by the Free Software
        Foundation; either version 2 of the License, or (at your option) any later version.

        This program is distributed in the hope that it will be useful, but WITHOUT ANY
        WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
        PARTICULAR PURPOSE. See the GNU General Public License for more details.

        You should have received a copy of the GNU General Public License along with this
        program; if not, write to the

        Free Software Foundation, Inc.,
        59 Temple Place, Suite 330,
        Boston, MA 02111-1307, USA.
        
********************************************************************************************/
#include "timer.h"

/* Constructor */
Timer::Timer()
{
	tm.sec = 0;
}

/* Return current second */
int Timer::retSec()
{

	if(tm.sec < clock()/CLOCKS_PER_SEC)
		tm.sec++;

	return tm.sec;
}

/* Draw Time on screen */
SDL_Surface* DrawTime(TTF_Font *font, SDL_Rect rect, int sec)
{
	SDL_Surface *surface;
	SDL_Color scorefontcolor = {255,0,0};
	char buffer[255];
	sprintf(buffer,"Time: %.3d ", sec);
	
	surface = TTF_RenderText_Solid(font,buffer,scorefontcolor);
	return surface;
}
